﻿using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace scheduler
{
    public class Logger
    {
        private string logFileName;

        public Logger()
        {
            var fileName = Assembly.GetEntryAssembly().Location;
            fileName = fileName.Substring(0, fileName.LastIndexOf('.') + 1) + "log";
            logFileName = fileName;
        }

        public void Log(string msg)
        {
            msg = string.Format("{0:G}: {1}{2}", DateTime.Now, msg, Environment.NewLine);
            Debug.Print(msg);

            File.AppendAllText(logFileName, msg);
        }
    }
}